package cc.mrbird.common.domin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.poi.ss.formula.functions.T;

@ApiModel(value = "PageInfo", description = "分页类")
public class PageUtil {
    @ApiModelProperty("总数")
    private long total;
    @ApiModelProperty("每页数量")
    private long pageSize;
    @ApiModelProperty("当前页号")
    private long pageNum;
    @ApiModelProperty("页数")
    private long pageCount;

    public PageUtil(IPage<T> t) {
        this.total = t.getTotal();
        this.pageSize = t.getSize();
        this.pageNum = t.getCurrent();
        this.pageCount = t.getPages();
    }

/*    public PageUtil(PageInfo<T> t) {
        this.total = t.getTotal();
        this.pageSize = t.getPageSize();
        this.pageNum = t.getPageNum();
        this.pageCount = t.getPages();
    }*/

/*    *//**
     * PageHelper分页
     **//*
    public static PageInfo<?> selectByPageNumSize(QueryRequest request, Supplier<?> s) {
        PageHelper.startPage(request.getPageNum(), request.getPageSize());
        com.github.pagehelper.PageInfo<?> pageInfo = new com.github.pagehelper.PageInfo<>((List<?>) s.get());
        PageHelper.clearPage();
        return pageInfo;
    }*/

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getPageSize() {
        return pageSize;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    public long getPageNum() {
        return pageNum;
    }

    public void setPageNum(long pageNum) {
        this.pageNum = pageNum;
    }

    public long getPageCount() {
        return pageCount;
    }

    public void setPageCount(long pageCount) {
        this.pageCount = pageCount;
    }
}
